package com.lagou.helper;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class Singleton {

    private Map<String, Long> respMap = new ConcurrentHashMap<>();

    private static final Singleton singleton = new Singleton();
    private Singleton() {}

    public static Singleton getInstance() {
        return singleton;
    }

    public static Long get(String ipPort) {
        if (singleton.respMap.isEmpty()) {
            return null;
        }
        return singleton.respMap.get(ipPort);
    }

    public static void put(String ipPort) {
        singleton.respMap.put(ipPort, System.currentTimeMillis());
    }
}
